#include <vector>
#include <iostream>

using namespace std;

bool checkRecord(string s) {
    int a = 0, l = 0;
    for(char c : s){
        if(c == 'A' && ++a >= 2) return false;
        if(c == 'L'){
            if(++l >= 3) return false;
        }else{
            l = 0;
        }
    }
    return true;
}

int main(){
    string s = "PPALLP";
    cout << checkRecord(s) << endl;
    return 0;
}